import request from '@/utils/request'

export function detail(data) {
  return new Promise((resolve, reject) => {
    request({
      url: '/api/poster/detail',
      method: 'get',
      data
	  // status:true
    }).then(data => {
      resolve(data)
    }).catch((e) => {
  		console.log(e);
      reject(e)
    })
  })
}

//字体列表
export function typeface(data) {
  return new Promise((resolve, reject) => {
    request({
      url: '/api/poster.typeface/list',
      method: 'get',
      data
	  // status:true
    }).then(data => {
      resolve(data)
    }).catch((e) => {
  		console.log(e);
      reject(e)
    })
  })
}

//换一批
export function getSutcategoryList(data) {
	return new Promise((resolve, reject) => {
	  request({
	    url: '/api/poster/rand',
	    method: 'get',
	    data
	  }).then(data => {
	    resolve(data)
	  }).catch((e) => {
			console.log(e);
	    reject(e)
	  })
	})
}

//默认图片
export function defaultImg(data) {
	return new Promise((resolve, reject) => {
	  request({
	    url: '/api/setting/defaultImg',
	    method: 'get',
	    data
	  }).then(data => {
	    resolve(data)
	  }).catch((e) => {
			console.log(e);
	    reject(e)
	  })
	})
}

//收藏
export function favorite(data) {
	return new Promise((resolve, reject) => {
	  request({
	    url: '/api/user/favorite',
	    method: 'post',
	    data
	  }).then(data => {
	    resolve(data)
	  }).catch((e) => {
			console.log(e);
	    reject(e)
	  })
	})
}

//判断是否收藏
export function hasfavorite(data) {
	return new Promise((resolve, reject) => {
	  request({
	    url: '/api/user/hasfavorite',
	    method: 'post',
	    data
	  }).then(data => {
	    resolve(data)
	  }).catch((e) => {
			console.log(e);
	    reject(e)
	  })
	})
}


//收藏列表
export function poster_favorite(data) {
	return new Promise((resolve, reject) => {
	  request({
	    url: '/api/poster/favorite',
	    method: 'post',
	    data
	  }).then(data => {
	    resolve(data)
	  }).catch((e) => {
			console.log(e);
	    reject(e)
	  })
	})
}


//保存作品
export function designadd(data) {
	return new Promise((resolve, reject) => {
	  request({
	    url: '/api/poster.design/add',
	    method: 'post',
	    data
	  }).then(data => {
	    resolve(data)
	  }).catch((e) => {
			console.log(e);
	    reject(e)
	  })
	})
}


//下载作品
export function download(data) {
	return new Promise((resolve, reject) => {
	  request({
	    url: '/api/poster.design/download',
	    method: 'post',
	    data
	  }).then(data => {
	    resolve(data)
	  }).catch((e) => {
			console.log(e);
	    reject(e)
	  })
	})
}



//我的作品列表
export function designlist(data) {
	return new Promise((resolve, reject) => {
	  request({
	    url: '/api/poster.design/list',
	    method: 'get',
	    data
	  }).then(data => {
	    resolve(data)
	  }).catch((e) => {
			console.log(e);
	    reject(e)
	  })
	})
}


//编辑我的作品
export function designedit(data) {
	return new Promise((resolve, reject) => {
	  request({
	    url: '/api/poster.design/edit',
	    method: 'post',
	    data
	  }).then(data => {
	    resolve(data)
	  }).catch((e) => {
			console.log(e);
	    reject(e)
	  })
	})
}


//我上传的图片列表
export function mypiclist(data) {
	return new Promise((resolve, reject) => {
	  request({
	    url: '/api/user/mypiclist',
	    method: 'post',
	    data
	  }).then(data => {
	    resolve(data)
	  }).catch((e) => {
			console.log(e);
	    reject(e)
	  })
	})
}


//删除我的作品
export function designdelete(data) {
	return new Promise((resolve, reject) => {
	  request({
	    url: '/api/poster.design/delete',
	    method: 'post',
	    data
	  }).then(data => {
	    resolve(data)
	  }).catch((e) => {
			console.log(e);
	    reject(e)
	  })
	})
}


//更多图片列表
export function defaultImgList(data) {
	return new Promise((resolve, reject) => {
	  request({
	    url: '/api/setting/defaultImgList',
	    method: 'post',
	    data
	  }).then(data => {
	    resolve(data)
	  }).catch((e) => {
			console.log(e);
	    reject(e)
	  })
	})
}

//文案中心标题列表
export function catelist(data) {
	return new Promise((resolve, reject) => {
	  request({
	    url: '/api/poster.copy_writing/catelist',
	    method: 'post',
	    data
	  }).then(data => {
	    resolve(data)
	  }).catch((e) => {
			console.log(e);
	    reject(e)
	  })
	})
}

//文案中心分类列表
export function copy_writinglist(data) {
	return new Promise((resolve, reject) => {
	  request({
	    url: '/api/poster.copy_writing/list',
	    method: 'GET',
	    data
	  }).then(data => {
	    resolve(data)
	  }).catch((e) => {
			console.log(e);
	    reject(e)
	  })
	})
}

//文案中心搜索热词
export function searchhotkey(data) {
	return new Promise((resolve, reject) => {
	  request({
	    url: '/api/poster.copy_writing/searchhotkey',
	    method: 'GET',
	    data
	  }).then(data => {
	    resolve(data)
	  }).catch((e) => {
			console.log(e);
	    reject(e)
	  })
	})
}

//文案中心搜索名称
export function search(data) {
	return new Promise((resolve, reject) => {
	  request({
	    url: '/api/poster.copy_writing/search',
	    method: 'post',
	    data
	  }).then(data => {
	    resolve(data)
	  }).catch((e) => {
			console.log(e);
	    reject(e)
	  })
	})
}
